import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:Smart/utils/screen_unit/gs_screen_util.dart';
//头灯欢迎隐藏页面
class HeadLampSetPage extends StatefulWidget {
  _HeadLampSetPageState createState() => _HeadLampSetPageState();
}

class _HeadLampSetPageState extends State<HeadLampSetPage> {
  //滑动开关初始值
  bool _isShow = false;
  bool _valued=false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 0,//阴影显示效果
        backgroundColor: Colors.white,
        leading: IconButton(
          icon: Icon(
            Icons.arrow_back_ios_rounded,
            color: Color(0xff231815),
          ),
          onPressed: () {
            Navigator.of(context).pop();
          },
        ),
        actions: [
          Text(
            '取消',
            style: TextStyle(fontSize: 20.w, color: Color(0xff141413)),
          ),
          SizedBox(width: 50),

          // Text(
          //   '存储',
          //   style: TextStyle(fontSize: 20.w, color: Color(0xff141413)),
          // ),

        ],

      ),
      body: SingleChildScrollView(child: Column(
        children: [
          Container(
            padding: EdgeInsets.fromLTRB(20, 10, 0, 0),
            height: 38.w,
            width: 828.w,
            child: Text('设置迎宾灯',style: TextStyle(
              color: Color(0xff666666),fontSize: 20.w
            ),),
            //设置边框
            decoration:
                BoxDecoration(border: Border(bottom: BorderSide(width: 0.1))),
          ),
          Divider(height:10),
          //开关隐藏栏
          Container(
            height: 38.w,
            width: 828.w,

            child: SwitchListTile(
                value: _isShow,
                //选中时滑块的颜色
                activeColor: Color(0xffFFFFFF),
                //选中时滑道的颜色
                activeTrackColor: Color(0xff141413),
                title: Text('开启迎宾灯'),
                onChanged: (val) {
                  setState(() {
                    _isShow=val;
                  });
                }),
          ),
          Divider(),
          Offstage(
            offstage: !_isShow,
            child: Container(
              height: 38.w,
             width: 828.w,
            // constraints: BoxConstraints.tight(Size(500.0,20.0)),
              margin:EdgeInsets.fromLTRB(20, 0, 0, 0),
              child: Text('设置迎宾灯开启条件'),
              decoration:
              BoxDecoration(border: Border(bottom: BorderSide(width: 0.1))),
            ),
          ),
          Offstage(
            offstage: !_isShow,
            child: Column(
              children: [
                CheckboxListTile(
                    value:this._valued ,
                    title: Text('靠近车身'),
                    onChanged: (valued){
                      setState(() {
                       this._valued=!this._valued;
                      });
                    }),
                Divider(),
                CheckboxListTile(
                    value:this._valued ,
                    title: Text('开启车锁'),
                    onChanged: (valued){
                      setState(() {
                      this._valued=!this._valued;
                      });
                    }),
                Divider()
              ],

            ),
          ),
          Offstage(
            offstage: !_isShow,
            child: Container(
              height: 28.w,
              width: 828,
              //constraints: BoxConstraints.tight(Size(500.0,20.0)),
              margin:EdgeInsets.fromLTRB(20, 0, 0, 0),
              child: Text('设置迎宾灯开启效果'),
              //设置边框
              decoration:
              BoxDecoration(border: Border(bottom: BorderSide(width: 0.02))),
            ),
          ),
          Offstage(
            offstage: !_isShow,
            child: Container(
              child: Column(
                children: [
                  CheckboxListTile(
                      value:this._valued ,
                      title: Text('车灯闪烁两下'),
                      onChanged: (valued){
                        setState(() {
                          this._valued=!this._valued;
                        });
                      }),
                  Divider(),
                  CheckboxListTile(
                      value:this._valued ,
                      title: Text('鸣笛两下'),
                      onChanged: (valued){
                        setState(() {
                          this._valued=!this._valued;
                        });
                      }),
                  Divider(),
                  CheckboxListTile(
                      value:this._valued,
                      title: Text('车灯连续闪烁'),
                      onChanged: (valued){
                        setState(() {
                          this._valued=!this._valued;
                        });
                      }),
                  Divider()
                ],
              ),
            ),
          )
        ],
      )),

    );
  }
}
